Skip to content

Conversation

@kurapov-peter
Copy link
Contributor

…ecuteOnLane0Op

The op declares three builders:

let builders = [
    OpBuilder<(ins "Value":$laneid, "int64_t":$warpSize)>,
    OpBuilder<(ins "TypeRange":$resultTypes, "Value":$laneid,
                   "int64_t":$warpSize)>,
    // `blockArgTypes` are different than `args` types as they are they
    // represent all the `args` instances visibile to lane 0. Therefore we need
    // to explicit pass the type.
    OpBuilder<(ins "TypeRange":$resultTypes, "Value":$laneid,
                   "int64_t":$warpSize, "ValueRange":$args,
                   "TypeRange":$blockArgTypes)>
  ];

This adds the missing implementation for the first builder.

@llvmbot
Copy link
Member

llvmbot commented Sep 26, 2024

@llvm/pr-subscribers-mlir-vector

@llvm/pr-subscribers-mlir

Author: Petr Kurapov (kurapov-peter)

Changes

…ecuteOnLane0Op

The op declares three builders:

let builders = [
    OpBuilder&lt;(ins "Value":$laneid, "int64_t":$warpSize)&gt;,
    OpBuilder&lt;(ins "TypeRange":$resultTypes, "Value":$laneid,
                   "int64_t":$warpSize)&gt;,
    // `blockArgTypes` are different than `args` types as they are they
    // represent all the `args` instances visibile to lane 0. Therefore we need
    // to explicit pass the type.
    OpBuilder&lt;(ins "TypeRange":$resultTypes, "Value":$laneid,
                   "int64_t":$warpSize, "ValueRange":$args,
                   "TypeRange":$blockArgTypes)&gt;
  ];

This adds the missing implementation for the first builder.


Full diff: https://github.com/llvm/llvm-project/pull/110106.diff

1 Files Affected:

  • (modified) mlir/lib/Dialect/Vector/IR/VectorOps.cpp (+6)
diff --git a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
index cac6b955457049..cf2b6e83f1fc0f 100644
--- a/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/IR/VectorOps.cpp
@@ -6421,6 +6421,12 @@ void WarpExecuteOnLane0Op::getSuccessorRegions(
   regions.push_back(RegionSuccessor(&getWarpRegion()));
 }
 
+void WarpExecuteOnLane0Op::build(OpBuilder &builder, OperationState &result,
+                                 Value laneId, int64_t warpSize) {
+  build(builder, result, TypeRange(), laneId, warpSize,
+        /*operands=*/std::nullopt, /*argTypes=*/std::nullopt);
+}
+
 void WarpExecuteOnLane0Op::build(OpBuilder &builder, OperationState &result,
                                  TypeRange resultTypes, Value laneId,
                                  int64_t warpSize) {

Copy link
Member

@MacDue MacDue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe simply remove the builder given it must be unused?

@kurapov-peter
Copy link
Contributor Author

Maybe simply remove the builder given it must be unused?

I think it is unused because there's no implementation :) All uses I've seen so far pass an empty TypeRange().

@banach-space
Copy link
Contributor

I agree with Ben.

If the builder is not used, it should be deleted rather than implemented. If it is to be added, there should also be examples of it being used (these would demonstrate that this is indeed needed).

As a rule of thumb, we should avoid implementing features that are not used - that's potential maintenance burden. While this is a rather small change, there's just no evidence of anyone needing it. Please correct me if I'm wrong :)

@kurapov-peter
Copy link
Contributor Author

Alright, I'm closing this

@kurapov-peter kurapov-peter deleted the warp-exeucte-on-lane-0-fix branch October 15, 2024 09:46
kurapov-peter added a commit that referenced this pull request Oct 28, 2024
#112338)

…ne0Op builder

Removing the declaration instead of implementing the builder as
discussed in #110106
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
llvm#112338)

…ne0Op builder

Removing the declaration instead of implementing the builder as
discussed in llvm#110106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants